package com.example.demo.control;

import com.alibaba.fastjson.JSON;
import com.example.demo.pojo.Business;
import com.example.demo.service.BusinessService;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@ResponseBody
@Controller
public class StoreControl {
    @Resource
    BusinessService businessService;
    @PostMapping("/c/StoreControlShow")
    public String StoreControlShow(String state,String name,String thispage){
        PageInfo<Business> businessPageInfo=businessService.c_StoreShow(Integer.parseInt(thispage),5,state,name);
        return JSON.toJSONString(businessPageInfo);
    }
    @PostMapping("/c/StoreControlUpdate")
    public String StoreControlUpdate1(String stateid,String seq){
        String businessPageInfo=businessService.c_StoreUpdate(stateid,seq);
        return JSON.toJSONString(businessPageInfo);
    }

    @PostMapping("/c/StoreControldelet")
    public String StoreControldelete1(String seq){
        String businessPageInfo=businessService.c_delete(Integer.parseInt(seq));
        return JSON.toJSONString(businessPageInfo);
    }
}
